import { $get, $put, $post, $delete } from './http'

// 获取角色列表
export const getRoleListReq = () => $get('/roles')

// 添加或编辑角色
export const addOrEditRoleReq = (id, params) =>
  id ? $put(`roles/${id}`, params) : $post('/roles', params)

// 删除角色
export const delRoleReq = id => $delete(`/roles/${id}`)

// 删除角色指定权限
export const delRoleAuthReq = (roleId, rightId) =>
  $delete(`/roles/${roleId}/rights/${rightId}`)

// 角色授权
export const editRoleAuthReq = (roleId, rids) =>
  $post(`/roles/${roleId}/rights`, { rids })
